package lab14Zoo;

public class Zoo {
	private Animal[] animals;
	private int numAnimals;
	private static final int MAX_ANIMALS=20;

	public Zoo() {
		super();
		numAnimals=0;
		animals=new Animal[MAX_ANIMALS];
	}
	
	public void removeAnimal (int i) {
		
		if (numAnimals<=i||i<0||i>=MAX_ANIMALS) {
			System.out.println("No animal at this index to remove");
			return;
		}
		for (int j = i; j < numAnimals; j++)
		{
			animals[j]=animals[j+1];
		}
		animals[numAnimals]=null;
		numAnimals--;
	}
	
	public void addAnimal(Animal animal) {
		if(numAnimals>=MAX_ANIMALS)  {
			System.out.println("Zoo is full.");
			return;
		}
		animals[numAnimals]=animal;
		numAnimals++;
	}

//	/**
//	 * @return the animals
//	 */
//	public Animal[] getAnimals() {
//		return animals;
//	}
	
	public Animal getAnimal(int i) {
		return animals[i];
	}

	/**
	 * @return the numAnimals
	 */
	public int getNumAnimals() {
		return numAnimals;
	}
	
}